package com.etc.service.impl;

import com.etc.dao.UsersMapper;
import com.etc.entity.Users;
import com.etc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.DecimalFormat;

/**
 * zj 用户业务层
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UsersMapper dao;
    @Override
    public boolean deleteByPrimaryKey(Integer uId) {
        int i =0;
        if (uId!=null){
            i=dao.deleteByPrimaryKey(uId);
        }
        return i>0;
    }

    @Override
    public boolean insert(Users record) {
        int i = 0;
        if (record!=null){
            i=dao.insert(record);
        }
        return i>0;
    }

    @Override
    public Users selectByPrimaryKey(Integer uId) {
        Users users=null;
        if (uId!=null){
             users = dao.selectByPrimaryKey(uId);
        }
        return users;
    }

    @Override
    public Users getlogin(String username, String userpwd) {
        return dao.login(username, userpwd);
    }


    /**
     * dhx
     *修改个人信息
     * @param u_id
     * @param u_name
     * @param u_password
     * @param u_sex
     * @return
     */

    @Override
    public boolean getModUsers(String u_id, String u_name, String u_password, String u_sex) {
        int x=dao.queryModUsers(u_id,u_name,u_password,u_sex);

        return x>0;
    }


}
